package com.cnwidsom.filter;

import com.cnwidsom.monitor.MonitorItem;

public class SimpleMysqlDBLogFilter extends LogDataFilter {
	@Override
	public boolean filter(MonitorItem mi) {
		if (mi != null && mi.getExtraData() != null) {
			if (mi.getExtraData() instanceof String) {
				String data = (String) mi.getExtraData();
				if (data.equalsIgnoreCase("select @@session.tx_read_only") || data.equalsIgnoreCase("SELECT @@session.tx_isolation")
						|| data.equalsIgnoreCase("SHOW WARNINGS") || data.startsWith("/* mysql-connector-java")) {
					return false;
				}
			}
		}
		return true;
	}

	@Override
	public String getFilterName() {
		return this.getClass().getName();
	}
}
